<!DOCTYPE html>
<html lang="en">

<head>
    <!-- Use correct character set. -->
    <meta charset="utf-8">
    <!-- Tell IE to use the latest, best version. -->
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <!-- Make the application on mobile take up the full browser screen and disable user scaling. -->
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">
    <title>Hello World!</title>
    <script src="../Build/CesiumUnminified/Cesium.js"></script>
    <style>
        @import url(../Build/CesiumUnminified/Widgets/widgets.css);
        html,
        body,
        #cesiumContainer {
            width: 100%;
            height: 100%;
            margin: 0;
            padding: 0;
            overflow: hidden;
        }
        
        #eye {
            position: absolute;
            width: 20%;
            height: 20%;
            bottom: 0;
            right: 0;
            z-index: 999;
            background: red;
            border: solid blue 1px;
        }
        
        #show {
            width: 100%;
            height: 100%;
        }
    </style>
</head>

<body>
        <div id="cesiumContainer">
        <div id="cesiumxin" style="position:fixed;left:0;z-index:99"><a href="http://cesium.xin" style="color:aliceblue;text-decoration:none">cesium中文网 http://cesium.xin </a></div>
    </div>
    <div id="credit"></div>
    <div id="eye"></div>
    <script>
        var viewer = new Cesium.Viewer('cesiumContainer', {
            imageryProvider: new Cesium.SingleTileImageryProvider({
                url: '../img/worldimage.jpg'
            }),
            //geocoder: false,
            homeButton: false,
            sceneModePicker: false,
            baseLayerPicker: false,
            navigationHelpButton: false,
            animation: false,
            creditContainer: "credit",
            timeline: false,
            fullscreenButton: false,
            vrButton: false
        });

        var viewer1 = new Cesium.Viewer('eye', {
            imageryProvider: new Cesium.SingleTileImageryProvider({
                url: '../img/worldimage.jpg'
            }),
            geocoder: false,
            homeButton: false,
            sceneModePicker: false,
            baseLayerPicker: false,
            navigationHelpButton: false,
            animation: false,
            creditContainer: "credit",
            timeline: false,
            fullscreenButton: false,
            vrButton: false
        });
        let control = viewer1.scene.screenSpaceCameraController;
        control.enableRotate = false;
        control.enableTranslate = false;
        control.enableZoom = false;
        control.enableTilt = false;
        control.enableLook = false;
        let syncViewer = function() {
            viewer1.camera.flyTo({
                destination: viewer.camera.position,
                orientation: {
                    heading: viewer.camera.heading,
                    pitch: viewer.camera.pitch,
                    roll: viewer.camera.roll
                },
                duration: 0.0
            });
        };
        //viewer.camera.changed.addEventListener(syncViewer);//卡顿
        viewer.scene.preRender.addEventListener(syncViewer);//成功

        //viewer.camera.moveStart.addEventListener(syncViewer);
        //viewer.camera.moveEnd.addEventListener(syncViewer);
    </script>
</body>

</html>